const HomeHttp = require("../../utils/Home")
Page({
  data: {
    detail: [],
    onClickIcon() {
      Toast('点击图标');
    },

    onClickButton() {
      Toast('点击按钮');
    },
  },
  onClickLeft() {
    wx.showToast({ title: '点击返回', icon: 'none' });
    wx.navigateBack()
  },
  onLoad:async function (option) {
    console.log(option);
    var { id } = option;
    var res = await HomeHttp.getDetail(id);
    // console.log(res.data);
    var arr = res.data;
    var detail = [];
    arr.forEach(item=>{
      var {price,comment_num,name,pic,title} = item;
      detail.push({
        comment_num,
        price,
        title,
        name:name.slice(10,32),
        pic
      })
    })
    this.setData({
      detail
    })
  },
})